
import http from '@/utils/http';
import type { MutationTree, ActionTree, GetterTree } from 'vuex';
import type { State } from '../index';

interface Infos {
  [index: string]: unknown
}

export interface SignsState {
  infos: Infos
}

const state: SignsState = {
  // 用户打卡信息
  infos: {}
};

const mutations: MutationTree<SignsState> = {
  updateInfos(state, payload){
    state.infos = payload;
  }
};
const actions: ActionTree<SignsState, State> = {
  /**
   * 获取用户打卡信息
   */
  getTime(context, payload){
    return http.get('/signs/time', payload);
  },
  
  /**
   * 更新用户打卡信息
   */
  putTime(context, payload){
    return http.put('/signs/time', payload);
  }
};
const getters: GetterTree<SignsState, State> = {};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}